Skip to content

Conversation

@heiparta
Copy link
Contributor

Expose energy consumption metric, ignoring outdated values which seem to happen often at least in a busier network.

Fixes feature request Koenkk/zigbee2mqtt#23139

return {};
}

globalStore.putValue(meta.device, "energy_last", scaled);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This store resets on every z2m restart (so that means that energy would be lost every time). You can persist it in _meta.device.meta.energy = xx; instead (this is saved to the data/database.db)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I was initially thinking that it does not matter if the status is lost on z2m restart as they are so rare, but it definitely makes sense as persisting the data turned out to be that easy.

FYI, the thermostat is really noisy, and I think it is internally sending stale data once in a while during its transmit bursts. This is what a non-filtered heating period looked on Homeassistant side:
image (I patched the filtering into my z2m container at the vertical line)

Expose energy consumption metric, ignoring outdated values which
seem to happen often at least in a busier network.
@Koenkk Koenkk merged commit 8f5af3a into Koenkk:master Jan 27, 2026
@Koenkk
Copy link
Owner

Koenkk commented Jan 27, 2026

Thanks!

@heiparta heiparta deleted the futurehome branch January 27, 2026 19:24
@PapsMan-No
Copy link

Thanks a lot! This is a very welcome and huge improvement – I can now access information on total energy usage per futurehome thermostat via the Zigbee2MQTT device panel. This is awesome!

However, when I add a device such as sensor.fh_4_zb_3_meter_elec_e_import in the energy panel, nothing is updated / added. (I waited for a day to be sure.)

When I monitor current activity in the Zigbee2MQTT device panel, I see regular updates from other devices (such as my Futurehome provided smart plug and my Futurehome provided Develco HAN sensor), but nothing from the futurehome thermostats.

Is this information not available or do I need to do something to access current energy consumption?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants